![]() |
HCreate |
||||
Header: | Files.h | Carbon status: | Supported | |
Creates a new file.
OSErr HCreate ( SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, OSType creator, OSType fileType );
A volume reference number, a working directory reference number, or 0 for the default volume.
A directory ID.
The name of the new file.
The creator of the new file.
The file type of the new file.
A result code.
The HCreate function creates a new file (both forks) with the specified name, creator, and file type. The new file is unlocked and empty. The date and time of its creation and last modification are set to the current date and time.
Files created using HCreate are not automatically opened. If you want to write data to the new file, you must first open the file using a file access function.
The resource fork of the new file exists but is empty. You’ll need to call one of the Resource Manager procedures CreateResFile, HCreateResFile, or FSpCreateResFile to create a resource map in the file before you can open it (by calling one of the Resource Manager functions OpenResFile, HOpenResFile, or FSpOpenResFile).
You should not allow users to give files names that begin with a period (.). This ensures that files can be successfully opened by applications calling HOpen instead of HOpenDF.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)